﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BCGC.BLL.Helper;
using Jalal.Library.Web;
using BCGC.BLL.Forum;

public partial class abuse_post : PublicBasePage
{
    public int PostID
    {
        get
        {
            if (Request.QueryString["postid"] != null)
                return Convert.ToInt32(Request.QueryString["postid"].ToString());
            else
                return -1;
        }

    }


    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (!SessionManager.IsUserLoggedIn)
            {
                SessionManager.ReturnUrl = CustomSiteMap.StartTopic;
                Response.Redirect(CustomSiteMap.Login);
            }
           
        }
    }

    protected void btnReset_Click(object sender, EventArgs e)
    {
        txtContent.Text = "";
       
    }


    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {

            if (ForumManager.ReportAbuse(PostID, SessionManager.LoggedUser.Id, Server.HtmlEncode(txtContent.Text.Trim()), false))
            {
                rmResult.SetSuccessMessage("Your report is send to Admin for review.");
            }
            else
            {
                rmResult.SetFailMessage("Abuse report submission failed.Please try again later.");
            }
        }
    }
}
